package com.sky.haikangdemo.controller;

import com.sky.haikangdemo.config.PlateConfig;
import com.sky.haikangdemo.utils.HikVisionSDKInitUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Yutiansong
 * @CreateTime: 2025/01/16 16:16
 * @Description: TODO 道闸控制
 * @Version: 1.0
 */
@RestController
public class PlateController {

    @GetMapping("/close")
    public void close() {
        String key = PlateConfig.deviceIp + PlateConfig.devicePort + PlateConfig.username + PlateConfig.password;
        HikVisionSDKInitUtil.remoteControl(key, PlateConfig.POLE_CLOSED);
    }

    @GetMapping("/open")
    public void open() {
        String key = PlateConfig.deviceIp + PlateConfig.devicePort + PlateConfig.username + PlateConfig.password;
        HikVisionSDKInitUtil.remoteControl(key, PlateConfig.POLE_OPEN);
    }

    /**
     * 语音播报
     */
    @GetMapping("/voice")
    public void voice(String content) {
        String key = PlateConfig.deviceIp + PlateConfig.devicePort + PlateConfig.username + PlateConfig.password;
        HikVisionSDKInitUtil.voiceBroadcast(key, content);
    }

    /**
     * led显示
     */
    @GetMapping("/led")
    public void led(String content) {
        String key = PlateConfig.deviceIp + PlateConfig.devicePort + PlateConfig.username + PlateConfig.password;
        HikVisionSDKInitUtil.ledBroadcast(key, content, "test");
    }
}
